export function alipay(provider, orderInfo, success, fail, complete) {
	// uniapp官方Api，直接调用，传入参数
	uni.requestPayment({
		provider: 'alipay',
		orderInfo: orderInfo, //支付宝订单数据  订单号
		success: function(res) {
			console.log('success:' + JSON.stringify(res));
			success && success(res.data);
		},
		fail: function(err) {
			console.log('fail:' + JSON.stringify(err));
			uni.showToast({
				title: '支付失败',
				icon: 'none',
				duration: 2000
			});
			fail && fail(err.data);
		}
	})
}

export function wxpay(provider, orderInfo, success, fail, complete) {
	uni.requestPayment({
		provider: 'wxpay',
		timeStamp: orderInfo.timeStamp,
		nonceStr: orderInfo.nonceStr,
		package: orderInfo.package,
		signType: 'MD5',
		paySign: orderInfo.paySign,
		success: function(res) {
			success && success(res.data);
		},
		fail: function(err) {
			uni.showToast({
				title: '支付失败',
				icon: 'none',
				duration: 2000
			});
			fail && fail(err.data);
		},
		complete(ress) {
			complete && complete(ress.data);
		}
	});
}